package org.sunshine.miracle.web.gwt.client;

import com.extjs.gxt.ui.client.data.BaseModelData;

/**
 * User: djiva
 * Date: Dec 10, 2008
 * Time: 2:23:14 PM
 */
public class FileModel extends BaseModelData {

    protected FileModel() {

    }

    public FileModel(String name, String path) {
        setName(name);
        setPath(path);
    }

    public FileModel(String name, String path, boolean dir) {
        setName(name);
        setPath(path);
        setDirectory(dir);
    }

    public void setName(String name) {
        set("name", name);
    }

    public void setPath(String path) {
        set("path", path);
    }


    public String getPath() {
        return get("path");
    }

    public String getName() {
        return get("name");
    }

    public void setDirectory(boolean dir){
        String value = dir ? "true" : "false";
        set("directory", value);
    }

    public boolean isDirectory(){
        return "true".equals(get("directory"));
    }
}
